Repository navigation
feat(server): default delegate_task placement to auto and protect active interactive hosts - #265
Conversation
…ive interactive hosts Implements M0 Item 1 from the Bot Runtime Plan (CLO-1368): - Default omitted `delegate_task` `placement` to `"auto"` (governed by `automaticPlacementByDefault`) so bursts of delegated tasks fan out to eligible headless executors instead of landing on the origin laptop. - Allow `isolation: "worktree"` to place onto headless executors when the parent checkout's HEAD is reachable from a pushed remote ref, launching the remote worktree with `startFromOrigin: true`. - Refuse agent-origin child launches on an interactive host while its human is active (or activity is unknown), unless `needsLocalCheckout: true` is explicitly set; cap that exception to at most one active local child at a time (concurrency-safe via semaphore). - Add contract schema and end-to-end tests covering the 12-request review burst replay (with headless capacity and with zero eligible headless executors), active-human refusal, pushed vs. unpushed worktree routing, and the one-at-a-time `needsLocalCheckout` exception. Model: gemini-4-neon Task: implementation Agent: Builder Harness: t3/antigravity Model-family: Gemini (runtime model label) Model-generation: 4 (runtime model label) Skills-SHA: f6ff9413445ca486f4e9b67f2209e6be8c2a51a1; skills/github-repository-ops/SKILL.md (sha256:e3778c3a953bfa9e7bf5c9b9609b6d6c947cffa03366b3bc0f75bbb722b76784)
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Clean-room full review #1 of 2 (Tier 3) for PR #265 ( SummaryThe core M0 item 1 implementation is solid and well-tested:
Two findings (1
{
"reviewed_base": "6382e077dede0c225c1cac0c7b2c4ec14e0a04a8",
"reviewed_head": "cd3aabe42d76b300d399fcf61d3bb766698f3523",
"reviewer": "gemini-4-neon, Antigravity (T3)",
"author_session": "mcp:launch:258c8272bae1cf3f711984e8716295f8ed1a2846e2f3b35631fa62e31c82a176",
"reviewer_session": "852a1490-8a73-4018-af52-21358d0b5481",
"fresh_context": true,
"review_kind": "full",
"round_id": "852a1490-8a73-4018-af52-21358d0b5481",
"intent": [
"CLO-1368 M0-1: default delegate_task placement to auto, allow worktree placement on headless hosts, and refuse agent-origin children on active interactive hosts unless needsLocalCheckout is set (one at a time)"
],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "open",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3212,
"summary": "Idempotent retry of a remotely-placed `isolation: \"worktree\"` task bypasses bound placement when local `HEAD` advances to an unpushed commit (or `automaticPlacementByDefault` is toggled off): `delegateTask` only checks `existingLocalReceipt` and skips `placeTask` when `canPlaceRemotely` is false, launching a duplicate local child on headless/idle hosts or failing with `invalid_request` on active interactive hosts instead of reconciling the bound remote placement (and `RemoteDelegation.delegate` at `apps/server/src/peer/RemoteDelegation.ts:1018` rejects missing `workspaceStrategy` before `launchThere` checks the bound `remote-launch` intent)."
},
{
"id": "F2",
"severity": "nit",
"outcome": "open",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3296,
"summary": "Refusal message when `placement: \"here\"` (or local `target.environmentId`) is combined with `isolation: \"worktree\"` on an active interactive host claims no pushed ref covers `HEAD` even though `needsPushedWorktree` was false and `resolvePushedWorktreeStrategy` was not run; guard with `needsPushedWorktree && remoteWorktreeStrategy === undefined`."
}
]
} |
…-human worktree message Addresses clean-room review findings F1 and F2 on PR #265: - F1: Check `remoteDelegation.placed(...)` before re-evaluating `automaticPlacementByDefault` or local HEAD in `OrchestratorMcpService.ts`, and reconcile already-recorded / already-launched `clientRequestId` retries in `RemoteDelegation.ts` before requiring a pushed worktree strategy so a retry after local HEAD moves to an unpushed commit or default placement is toggled off never spawns a duplicate local child or fails with invalid_request. - F2: Guard the "no pushed ref covers HEAD" active-human refusal message with `needsPushedWorktree && remoteWorktreeStrategy === undefined` so explicit `placement: "here"` or local `target.environmentId` with `isolation: "worktree"` reports the general active-human refusal accurately. - Tests: Add regression coverage for recorded and lost-answer remote worktree retries after local HEAD becomes unpushed and `automaticPlacementByDefault` is disabled, plus F2 refusal wording assertions in `RemoteDelegation.test.ts`. Model: gemini-4-neon Task: fix Agent: Builder Harness: t3/antigravity Model-family: Gemini (runtime model label) Model-generation: 4 (runtime model label) Skills-SHA: f6ff9413445ca486f4e9b67f2209e6be8c2a51a1; skills/github-repository-ops/SKILL.md (sha256:e3778c3a953bfa9e7bf5c9b9609b6d6c947cffa03366b3bc0f75bbb722b76784)
|
Focused re-check (Claude family) for PR #265 at
{
"reviewed_base": "6382e077dede0c225c1cac0c7b2c4ec14e0a04a8",
"reviewed_head": "b9deb59d7332dd78b6c3dbabb13fb3cfbdd538b1",
"reviewer": "claude-sonnet-5-5 (t3/antigravity)",
"author_session": "mcp:launch:258c8272bae1cf3f711984e8716295f8ed1a2846e2f3b35631fa62e31c82a176",
"reviewer_session": "ba710ea0-ff3e-4d0f-993e-d45bed81420a",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "852a1490-8a73-4018-af52-21358d0b5481",
"intent": [
"CLO-1368 M0-1: default delegate_task placement to auto, allow worktree placement on headless hosts, and refuse agent-origin children on active interactive hosts unless needsLocalCheckout is set (one at a time)"
],
"prior_findings": ["F1", "F2"],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "confirmed",
"rechecked_head": "b9deb59d7332dd78b6c3dbabb13fb3cfbdd538b1",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3212,
"summary": "Idempotent retry of a remotely-placed `isolation: \"worktree\"` task now checks bound placement (`remoteDelegation.placed`) before local HEAD or `automaticPlacementByDefault`; `RemoteDelegation.delegate` reconciles prior launch/child intents instead of rejecting a missing `workspaceStrategy`. Covered by a new retry test."
},
{
"id": "F2",
"severity": "nit",
"outcome": "fixed",
"rechecked_head": "b9deb59d7332dd78b6c3dbabb13fb3cfbdd538b1",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3339,
"summary": "The refusal message now claims no pushed ref covers HEAD only when `needsPushedWorktree && remoteWorktreeStrategy === undefined`; `placement: \"here\"` and a local `target.environmentId` with `isolation: \"worktree\"` get the generic active-human message. Covered by new tests."
}
]
} |
|
Note 🤖 grok-4.7 responding on behalf of nullStack65 M0 item 1 is in place for the laptop burst, and one correctness bug should be fixed before merge. Omitted Overflow is a failed call ( {
"reviewed_base": "6382e077dede0c225c1cac0c7b2c4ec14e0a04a8",
"reviewed_head": "b9deb59d7332dd78b6c3dbabb13fb3cfbdd538b1",
"reviewer": "grok-4.7 (t3/grok-direct)",
"author_session": "mcp:launch:258c8272bae1cf3f711984e8716295f8ed1a2846e2f3b35631fa62e31c82a176",
"reviewer_session": "01a23ff6-ca86-7442-b18e-aa9c82e7a7f8",
"fresh_context": true,
"review_kind": "full",
"round_id": "01a23ff6-ca86-7442-b18e-aa9c82e7a7f8",
"intent": ["CLO-1368 M0-1: default delegate_task placement to auto, allow worktree placement on headless hosts, and refuse agent-origin children on active interactive hosts unless needsLocalCheckout is set (one at a time)"],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "open",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 2611,
"summary": "resolvePushedWorktreeStrategy falls through to the default branch tip whenever HEAD is only an ancestor of that tip and the current branch remote ref does not contain HEAD. An unpushed feature branch cut from a stale local default (origin/main has moved) is placed on a headless host as baseRef origin/<default> with startFromOrigin true, so the child checkout is neither the parent branch nor the parent commit. The real-git test covers a fully pushed main and a new commit that is not an ancestor of origin/main, and does not cover this fallback."
},
{
"id": "F2",
"severity": "nit",
"outcome": "open",
"file": "packages/contracts/src/orchestratorMcp.ts",
"line": 200,
"summary": "The placement description quotes 'worktree' next to the accepted literals auto and here. placement only accepts auto and here; a model that copies the description sends placement \"worktree\" and schema validation rejects it. Worktree is an isolation value."
}
]
} |
…ktree placement and clarify placement copy Addresses clean-room review 2/2 (Grok 4.7) findings F1 and F2 on PR #265: - F1: In `resolvePushedWorktreeStrategy` (`OrchestratorMcpService.ts`), check exact commit SHA equality (`resolveCommit` on `HEAD` vs `refs/remotes/...`) and prefer the live checked-out branch via `symbolic-ref`, rather than `merge-base --is-ancestor`, so an unpushed feature branch cut from an older commit (or a stale local default branch) never falls through to a newer `origin/<default>` tip. - F2: In `packages/contracts/src/orchestratorMcp.ts`, stop quoting `'worktree'` alongside `'auto'` and `'here'` in the `placement` description since `worktree` is an `isolation` value. - Tests: Extend the real-Git worktree test in `OrchestratorMcpService.test.ts` to cover an unpushed branch cut from an older `origin/main` commit (refused) and then pushed as `origin/feat/older-base` (placed on the headless host), and update the `GitVcsDriver.resolveCommit` mock in `RemoteDelegation.test.ts`. Model: gemini-4-neon Task: fix Agent: Builder Harness: t3/antigravity Model-family: Gemini (runtime model label) Model-generation: 4 (runtime model label) Skills-SHA: f6ff9413445ca486f4e9b67f2209e6be8c2a51a1; skills/github-repository-ops/SKILL.md (sha256:e3778c3a953bfa9e7bf5c9b9609b6d6c947cffa03366b3bc0f75bbb722b76784)
|
Note 🤖 grok-4.7 responding on behalf of nullStack65 Focused re-check of Grok F1 and F2 on F1 confirmed. F2 fixed. The Static read of that delta and the new test. I did not execute the test. CI on this head was still queued. {
"reviewed_base": "6382e077dede0c225c1cac0c7b2c4ec14e0a04a8",
"reviewed_head": "78ff443513344d87bf769931495652e8616e9eca",
"reviewer": "grok-4.7 (t3/grok-direct)",
"author_session": "mcp:launch:258c8272bae1cf3f711984e8716295f8ed1a2846e2f3b35631fa62e31c82a176",
"reviewer_session": "84ed06bd-2ded-43e1-be60-86ef242c0b41",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "01a23ff6-ca86-7442-b18e-aa9c82e7a7f8",
"intent": ["CLO-1368 M0-1: default delegate_task placement to auto, allow worktree placement on headless hosts, and refuse agent-origin children on active interactive hosts unless needsLocalCheckout is set (one at a time)"],
"prior_findings": ["F1", "F2"],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "confirmed",
"rechecked_head": "78ff443513344d87bf769931495652e8616e9eca",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 2607,
"summary": "resolvePushedWorktreeStrategy now requires the remote tip SHA to equal HEAD (matchesHead at line 2580). The default-branch fallback at line 2607 uses that check, so an unpushed branch whose HEAD is only an ancestor of origin/<default> is not placed on the newer tip. The live git test checks out feat/older-base at HEAD~1 after origin/main advances and expects refusal until that branch itself is pushed."
},
{
"id": "F2",
"severity": "nit",
"outcome": "fixed",
"file": "packages/contracts/src/orchestratorMcp.ts",
"line": 200,
"summary": "The placement description no longer quotes worktree next to the accepted literals auto and here. It says the remote checkout is created when isolation is set to worktree. Schema.Literals remains [\"auto\", \"here\"]."
}
]
} |
|
Focused re-check (Claude family) for PR #265 at
{
"reviewed_base": "6382e077dede0c225c1cac0c7b2c4ec14e0a04a8",
"reviewed_head": "78ff443513344d87bf769931495652e8616e9eca",
"reviewer": "claude-sonnet-5-5 (t3/antigravity)",
"author_session": "mcp:launch:258c8272bae1cf3f711984e8716295f8ed1a2846e2f3b35631fa62e31c82a176",
"reviewer_session": "a184b9e5-1f31-480e-ac12-4a3458200613",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "852a1490-8a73-4018-af52-21358d0b5481",
"intent": [
"CLO-1368 M0-1: default delegate_task placement to auto, allow worktree placement on headless hosts, and refuse agent-origin children on active interactive hosts unless needsLocalCheckout is set (one at a time)"
],
"prior_findings": ["F1", "F2"],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "confirmed",
"rechecked_head": "78ff443513344d87bf769931495652e8616e9eca",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3187,
"summary": "Idempotent retry of a remotely-placed `isolation: \"worktree\"` task still checks bound placement (`remoteDelegation.placed`) before local HEAD or `automaticPlacementByDefault`, and `RemoteDelegation.delegate` reconciliation is unchanged by this delta."
},
{
"id": "F2",
"severity": "nit",
"outcome": "fixed",
"rechecked_head": "78ff443513344d87bf769931495652e8616e9eca",
"file": "apps/server/src/mcp/OrchestratorMcpService.ts",
"line": 3335,
"summary": "The pushed-ref refusal wording is still guarded by `needsPushedWorktree && remoteWorktreeStrategy === undefined`; `placement: \"here\"` and local `target.environmentId` get the generic active-human message."
}
]
} |
Implements M0 Item 1 from the Bot Runtime Plan (
CLO-1368).Problem
When a thread on an interactive laptop dispatches a burst of
delegate_taskcalls (such as 12 review tasks) without settingplacement: "auto", or withisolation: "worktree", tasks fell back onto the origin laptop while a human was actively using it instead of fanning out to headless executors (R720,ASUS) and queueing overflow cleanly.Changes
placementto"auto"(apps/server/src/mcp/OrchestratorMcpService.ts,packages/contracts/src/orchestratorMcp.ts): Omittedplacementondelegate_tasknow defaults to"auto"wheneverautomaticPlacementByDefaultis enabled (fork default, marked withClosura:comments), unlesstarget.environmentIdorneedsLocalCheckout: trueis specified or an idempotent retry matches an accepted local receipt. Added"here"literal toplacementand optionalneedsLocalCheckoutboolean toOrchestratorMcpDelegateTaskInput.apps/server/src/mcp/OrchestratorMcpService.ts,apps/server/src/peer/RemoteDelegation.ts):isolation: "worktree"resolves whether the parent checkout'sHEADis reachable from a pushed remote ref (<remote>/<branch>) and, when pushed, routes to an eligible headless host passing{ type: "worktree", baseRef, startFromOrigin: true }tot3_thread_launch. Unpushed local-only worktrees are refused on linked peers and never silently placed remotely.needsLocalCheckoutexception (apps/server/src/mcp/OrchestratorMcpService.ts): Refuses agent-origin child launches on an interactive host (placementRole !== "headless") while its human is active or activity is unknown (humanActive !== false), unlessneedsLocalCheckout: trueis explicitly set. WhenneedsLocalCheckout: trueis set, enforces at most one active local agent-origin child at a time viaSemaphore.make(1)+ active shell/run verification (preserving idempotent replay for the admittedclientRequestId).packages/contracts/src/orchestratorMcp.test.ts,apps/server/src/peer/RemoteDelegation.test.ts,apps/server/src/mcp/OrchestratorMcpService.test.ts,apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts,apps/server/src/mcp/TaskCancelNativeSubagent.integration.test.ts):R720(4 lanes) +ASUS(1 lane): 4 on R720, 1 on ASUS (all worktrees withstartFromOrigin: true), 7 queued (no-eligible-environment), 0 on laptop.no-eligible-environment), 0 on laptop even withoutmaxLanes: 0.placement: "here", named laptopenvironmentId, unpushed worktree, unknownhumanActive, conflictingneedsLocalCheckout+placement: "auto") and allowed whenhumanActive: false.needsLocalCheckoutexception: admit first, replay idempotent retry, refuse second while first active, allow next after completion, concurrent pair admits 1 and refuses 1.Zero file overlap with open PR #261 (
fix/standing-placement-off-laptop).Verification
vp fmt --checkon all 8 changed files: passvp lint --report-unused-disable-directiveson all 8 changed files: pass (0 warnings, 0 errors)vp run --filter @t3tools/contracts --filter t3 typecheck: passvp test run packages/contracts/src/orchestratorMcp.test.ts packages/shared/src/threadPlacement.test.ts: 16/16 passcd apps/server && vp test run src/peer/RemoteDelegation.test.ts src/mcp/OrchestratorMcpService.test.ts: 184/184 pass (post-rebase oncd3aabe42d76)cd apps/server && vp test run src/mcp/OrchestratorMcpService.activity.test.ts src/mcp/TaskCancelNativeSubagent.integration.test.ts: 22/22 passapps/server/src/mcp/OrchestratorMcpToolkit.integration.test.tstimed out locally in the Codex replay harness (pre-existing stall even withautomaticPlacementByDefault: false);knip:check:filesfails repo-wide on two pre-existing unused.github/scripts/*.cjsfiles onrelease/native-0.1.10(0 unused files/exports from this PR).Deploy: fleet
Model: gemini-4-neon
Task: implementation
Agent: Builder
Harness: t3/antigravity
Model-family: Gemini (runtime model label)
Model-generation: 4 (runtime model label)
Skills-SHA: f6ff9413445ca486f4e9b67f2209e6be8c2a51a1; skills/github-repository-ops/SKILL.md (sha256:e3778c3a953bfa9e7bf5c9b9609b6d6c947cffa03366b3bc0f75bbb722b76784)